package ui.actions;

import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;

import tree.PageNode;
import tree.PageTree;
import ui.Main;
import util.Util;

/**
 * Clears the problem associated with the current page.
 * @author TKington
 *
 */
public class ClearSGFAction extends AbstractAction {
	/**
	 * Creates a ClearSGFAction.
	 */
	public ClearSGFAction() {
		putValue(NAME, "ClrSGF");
		putValue(SHORT_DESCRIPTION, "Remove Go Problem");
		//putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_N, ActionEvent.CTRL_MASK));
		putValue(SMALL_ICON, Util.getIcon("Delete16.gif")); //$NON-NLS-1$
	}
	
	public void actionPerformed(ActionEvent evt) {
		PageTree tree = PageTree.instance();
		PageNode curPage = tree.getSelectedPage();
		curPage.clearSGF();
		Main.frame.setDirty(true);
		Main.frame.gotoPage(curPage, false);
	}
}